package com.mxf.code.product_coupon.domain;

import com.mxf.code.product_coupon.enums.ProductTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author mxf
 * @version 1.0
 * @description: 满减
 * @date 2023/6/9
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FullReduction {

    public static final Map<String, List<FullReductionItem>> FULL_REDUCTION_BY_PRODUCT_TYPE_MAP;

    // 默认数据
    static {
        FULL_REDUCTION_BY_PRODUCT_TYPE_MAP = new HashMap<>();
        List<FullReductionItem> fullReductionItemList = new ArrayList<>();
        fullReductionItemList.add(new FullReductionItem(new BigDecimal("300"), new BigDecimal("30")));
        fullReductionItemList.add(new FullReductionItem(new BigDecimal("200"), new BigDecimal("10")));
        FULL_REDUCTION_BY_PRODUCT_TYPE_MAP.put(ProductTypeEnum.PRODUCT_TYPE1.getType(), fullReductionItemList);
        List<FullReductionItem> fullReductionItemList2 = new ArrayList<>();
        fullReductionItemList2.add(new FullReductionItem(new BigDecimal("100"), new BigDecimal("5")));
        FULL_REDUCTION_BY_PRODUCT_TYPE_MAP.put(ProductTypeEnum.PRODUCT_TYPE2.getType(), fullReductionItemList2);
    }

    private String productType;
    private List<FullReductionItem> fullReductionItemList;
}
